﻿/*
 * This is a .NET port of the Apache Chemistry QueryParser. http://chemistry.apache.org/
 * The conversion was performed by Brügmann Software GmbH. Programmer: Björn Kremer.
 *
 * This project is still under the original Apache License: 
 * 
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 * Contributors:
 *     Florent Guillaume, Nuxeo
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QueryParser
{
   using Tree = Antlr.Runtime.Tree.ITree;

   /// <summary>
   /// Interface for a tree walker of a WHERE clause.
   /// <p>
   /// Can be used to build another datastructure, or for direct value evaluation
   /// (thus the boolean return values for clauses, and Object for values).
   /// <p>
   /// The method <seealso cref="walkClause"/> is the entry point.
   /// </summary>
   public interface PredicateWalker : PredicateWalkerBase
   {

      bool? walkNot(Tree opNode, Tree leftNode);

      bool? walkAnd(Tree opNode, Tree leftNode, Tree rightNode);

      bool? walkOr(Tree opNode, Tree leftNode, Tree rightNode);

      object walkExpr(Tree node);

      bool? walkEquals(Tree eqNode, Tree leftNode, Tree rightNode);

      bool? walkNotEquals(Tree neNode, Tree leftNode, Tree rightNode);

      bool? walkGreaterThan(Tree gtNode, Tree leftNode, Tree rightNode);

      bool? walkGreaterOrEquals(Tree geNode, Tree leftNode, Tree rightNode);

      bool? walkLessThan(Tree ltNode, Tree leftNode, Tree rightNode);

      bool? walkLessOrEquals(Tree leqNode, Tree leftNode, Tree rightNode);

      bool? walkIn(Tree node, Tree colNode, Tree listNode);

      bool? walkNotIn(Tree node, Tree colNode, Tree listNode);

      bool? walkInAny(Tree node, Tree colNode, Tree listNode);

      bool? walkNotInAny(Tree node, Tree colNode, Tree listNode);

      bool? walkEqAny(Tree node, Tree literalNode, Tree colNode);

      bool? walkIsNull(Tree nullNode, Tree colNode);

      bool? walkIsNotNull(Tree notNullNode, Tree colNode);

      bool? walkLike(Tree node, Tree colNode, Tree stringNode);

      bool? walkNotLike(Tree node, Tree colNode, Tree stringNode);

      bool? walkContains(Tree node, Tree qualNode, Tree paramNode);

      bool? walkInFolder(Tree node, Tree qualNode, Tree paramNode);

      bool? walkInTree(Tree node, Tree qualNode, Tree paramNode);

      object walkList(Tree node);

      object walkBoolean(Tree node);

      object walkNumber(Tree node);

      object walkString(Tree node);

      object walkTimestamp(Tree node);

      object walkCol(Tree node);

      object walkId(Tree node);

   }
}
